-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add a terminate ingest processor
#114157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a terminate ingest processor
#114157
Conversation
This processor simply causes any remaining processors in the pipeline
to be skipped. It will normally be executed conditionally using the
`if` option. (If this pipeline is being called from another pipeline,
the calling pipeline is *not* terminated.)
For example, this:
```
POST /_ingest/pipeline/_simulate
{
"pipeline":
{
"description": "Appends just 'before' to the steps field if the number field
is present, or both 'before' and 'after' if not",
"processors": [
{
"append": {
"field": "steps",
"value": "before"
}
},
{
"terminate": {
"if": "ctx.error != null"
}
},
{
"append": {
"field": "steps",
"value": "after"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": []
}
},
{
"_index": "index",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": []
}
}
]
}
```
returns something like this:
```
{
"docs": [
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": [
"before",
"after"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448881Z"
}
}
},
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": [
"before"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448932Z"
}
}
}
]
}
```
|
Documentation preview: |
|
Hi @PeteGillinElastic, I've created a changelog YAML for you. |
|
Hi @PeteGillinElastic, I've updated the changelog YAML for you. |
1 similar comment
|
Hi @PeteGillinElastic, I've updated the changelog YAML for you. |
df8c436 to
4574150
Compare
|
Pinging @elastic/es-data-management (Team:Data Management) |
|
@dakrone Are you the best person to review this, since we were talking about the reroute mechanism earlier? |
dakrone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding this Pete!
💚 Backport successful
|
This processor simply causes any remaining processors in the pipeline
to be skipped. It will normally be executed conditionally using the
`if` option. (If this pipeline is being called from another pipeline,
the calling pipeline is *not* terminated.)
For example, this:
```
POST /_ingest/pipeline/_simulate
{
"pipeline":
{
"description": "Appends just 'before' to the steps field if the number field
is present, or both 'before' and 'after' if not",
"processors": [
{
"append": {
"field": "steps",
"value": "before"
}
},
{
"terminate": {
"if": "ctx.error != null"
}
},
{
"append": {
"field": "steps",
"value": "after"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": []
}
},
{
"_index": "index",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": []
}
}
]
}
```
returns something like this:
```
{
"docs": [
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": [
"before",
"after"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448881Z"
}
}
},
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": [
"before"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448932Z"
}
}
}
]
}
```
This processor simply causes any remaining processors in the pipeline
to be skipped. It will normally be executed conditionally using the
`if` option. (If this pipeline is being called from another pipeline,
the calling pipeline is *not* terminated.)
For example, this:
```
POST /_ingest/pipeline/_simulate
{
"pipeline":
{
"description": "Appends just 'before' to the steps field if the number field
is present, or both 'before' and 'after' if not",
"processors": [
{
"append": {
"field": "steps",
"value": "before"
}
},
{
"terminate": {
"if": "ctx.error != null"
}
},
{
"append": {
"field": "steps",
"value": "after"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": []
}
},
{
"_index": "index",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": []
}
}
]
}
```
returns something like this:
```
{
"docs": [
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": [
"before",
"after"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448881Z"
}
}
},
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": [
"before"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448932Z"
}
}
}
]
}
```
A docs page for the `terminate` processor was added in elastic#114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
A docs page for the `terminate` processor was added in #114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
A docs page for the `terminate` processor was added in elastic#114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
A docs page for the `terminate` processor was added in #114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
This processor simply causes any remaining processors in the pipeline
to be skipped. It will normally be executed conditionally using the
`if` option. (If this pipeline is being called from another pipeline,
the calling pipeline is *not* terminated.)
For example, this:
```
POST /_ingest/pipeline/_simulate
{
"pipeline":
{
"description": "Appends just 'before' to the steps field if the number field
is present, or both 'before' and 'after' if not",
"processors": [
{
"append": {
"field": "steps",
"value": "before"
}
},
{
"terminate": {
"if": "ctx.error != null"
}
},
{
"append": {
"field": "steps",
"value": "after"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": []
}
},
{
"_index": "index",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": []
}
}
]
}
```
returns something like this:
```
{
"docs": [
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": [
"before",
"after"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448881Z"
}
}
},
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": [
"before"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448932Z"
}
}
}
]
}
```
A docs page for the `terminate` processor was added in elastic#114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
This processor simply causes any remaining processors in the pipeline
to be skipped. It will normally be executed conditionally using the
`if` option. (If this pipeline is being called from another pipeline,
the calling pipeline is *not* terminated.)
For example, this:
```
POST /_ingest/pipeline/_simulate
{
"pipeline":
{
"description": "Appends just 'before' to the steps field if the number field
is present, or both 'before' and 'after' if not",
"processors": [
{
"append": {
"field": "steps",
"value": "before"
}
},
{
"terminate": {
"if": "ctx.error != null"
}
},
{
"append": {
"field": "steps",
"value": "after"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": []
}
},
{
"_index": "index",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": []
}
}
]
}
```
returns something like this:
```
{
"docs": [
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc1",
"_source": {
"name": "okay",
"steps": [
"before",
"after"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448881Z"
}
}
},
{
"doc": {
"_index": "index",
"_version": "-3",
"_id": "doc2",
"_source": {
"name": "bad",
"error": "oh no",
"steps": [
"before"
]
},
"_ingest": {
"timestamp": "2024-10-04T16:25:20.448932Z"
}
}
}
]
}
```
A docs page for the `terminate` processor was added in elastic#114157, but the change to include it in the outer processor reference page was omitted. This change corrects that oversight.
This processor simply causes any remaining processors in the pipeline to be skipped. It will normally be executed conditionally using the
ifoption. (If this pipeline is being called from another pipeline, the calling pipeline is not terminated.)For example, this:
returns something like this:
closes #110218